package com.yh.rbac.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.yh.rbac.dao.UserRoleMapper;
import com.yh.rbac.entity.UserRole;
import com.yh.rbac.service.UserRoleService;
@Service
public class UserRoleServiceImpl implements UserRoleService {

	@Resource
	private UserRoleMapper userRoleMapper ;
	@Transactional(propagation=Propagation.REQUIRED)
	@Override
	public int insert(UserRole record) {
		return userRoleMapper.insert(record) ;
	}

	@Override
	public List<UserRole> selectAll() {
		return userRoleMapper.selectAll() ;
	}

	@Override
	public UserRole selectByRidAndUid(Long rid, Long uid) {
		return userRoleMapper.selectByRidAndUid(rid, uid);
	}

	@Override
	public List<UserRole> selectByUid(Long uid) {
		return userRoleMapper.selectByUid(uid) ;
	}

	@Transactional(propagation = Propagation.REQUIRED)
	@Override
	public int deleteByUidOrRid(Long uid , Long rid) {
		return userRoleMapper.deleteByUidOrRid(uid,rid) ;
	}

}
